package cn.zhfeat.core.shiro;

import cn.zhfeat.core.shiro.bean.ShiroSysAuthorityBean;

import java.io.Serializable;
import java.util.List;

/**
 * @description: 用于封装用户登录后所绑定的数据
 *
 * @author ZhangHao
 * @date 2018年5月14日 上午11:28:17 
 * @version 1.0.0.1
 */
public class ShiroSessionData implements Serializable{


	private static final long serialVersionUID = 1L;

	/** 用户id*/
	private Long userId;
	
	/** 用户名称*/
	private String userName;
	
	/** 用户对应的一组角色名称*/
	private String roleNames;
	
	/** 用户手机号 */
	private String userAccount;
	
	/** 公司id*/
	private Long cid;
	
	/** 用户是否同意了系统协议 0同意,1不同意*/
	private Integer agreement;
	
	/** 用户对应的一组菜单权限*/
	private List<ShiroSysAuthorityBean> auths;
	
	/** 数据所属门店id */
	private Long belongStoreId;
	
	/** 数据所属门店名称*/
	private String belongStoreName;
	
	/** 数据所属部门id */
	private Long belongDepartmentId;
	
	/** 数据所属部门名称*/
	private String belongDepartmentName;
	
	/** 用户业务身份（该身份是基于数据库的用户身份逻辑处理后的身份）
	 * 1：个人    -  规则：数据权限按“组织、门店、个人”数据标记的“交集”进行过滤
	 * 2：管理    -  规则：数据权限按“组织、门店”数据标记的“并集”进行过过滤
	 * 
	 * 
	 * 		mybatis sql示例，未经测试版本，仅供参考：
	 * 
	 * 		     <if test="shiroSessionData.dataIdentity == '1'" >
	 *                  and create_id = shiroSessionData.userId
     *     		 </if>
     *     
     *     	  	  <if test="shiroSessionData.dataIdentity == '2'" >
	 *                  and create_id = shiroSessionData.userId
	 *              </if>
	 *              <if test="shiroSessionData.responsibleStoreIdsArr != null">
	 *   				or belong_store_id in
	 *   				<foreach collection="shiroSessionData.responsibleStoreIdsArr" item="sId" index="index" open="(" close=")" separator=",">
	 *   				   '${sId}'
	 *   				</foreach>
	 *   			</if>
	 *   			<if test="shiroSessionData.responsibleDepartmentIdsArr != null">
	 *   				 or belong_department_id in
	 *   			 	<foreach collection="shiroSessionData.responsibleDepartmentIdsArr" item="dId" index="index" open="(" close=")" separator=",">
	 * 	    			   '${dId}'
	 * 	    			</foreach>
	 *				</if>
     *     		  </if>
	 * 		 
	 * 
	 */
	private Integer dataIdentity;
	
	/** 用户负责的一组用户id , 按逗号分割 */
	private String  responsibleUserIds;
	
	/** 用户负责的一组部门id , 按逗号分割*/
	private String responsibleDepartmentIds;
	
	/** 用户负责的一组门店id , 按逗号分割*/
	private String responsibleStoreIds;

	/** 用户负责的一组用户id，数组*/
	private String[] responsibleUserIdsArr;

	/** 用户负责的一组部门id，数组*/
	private String[] responsibleDepartmentIdsArr;

	/** 用户负责的一组门店id,数组*/
	private String[] responsibleStoreIdsArr;

	/** 用户所属企业是否进行了微信授权*/
	private Integer wechatAuth;
	
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getUserAccount() {
		return userAccount;
	}

	public void setUserAccount(String userAccount) {
		this.userAccount = userAccount;
	}

	public Integer getDataIdentity() {
		return dataIdentity;
	}

	public void setDataIdentity(Integer dataIdentity) {
		this.dataIdentity = dataIdentity;
	}

	public Long getCid() {
		return cid;
	}

	public void setCid(Long cid) {
		this.cid = cid;
	}

	public Long getBelongStoreId() {
		return belongStoreId;
	}

	public void setBelongStoreId(Long belongStoreId) {
		this.belongStoreId = belongStoreId;
	}

	public Long getBelongDepartmentId() {
		return belongDepartmentId;
	}

	public void setBelongDepartmentId(Long belongDepartmentId) {
		this.belongDepartmentId = belongDepartmentId;
	}

	public String getResponsibleDepartmentIds() {
		return responsibleDepartmentIds;
	}

	public void setResponsibleDepartmentIds(String responsibleDepartmentIds) {
		this.responsibleDepartmentIds = responsibleDepartmentIds;
	}

	public String getResponsibleStoreIds() {
		return responsibleStoreIds;
	}

	public void setResponsibleStoreIds(String responsibleStoreIds) {
		this.responsibleStoreIds = responsibleStoreIds;
	}

	public String getResponsibleUserIds() {
		return responsibleUserIds;
	}

	public void setResponsibleUserIds(String responsibleUserIds) {
		this.responsibleUserIds = responsibleUserIds;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getRoleNames() {
		return roleNames;
	}

	public void setRoleNames(String roleNames) {
		this.roleNames = roleNames;
	}

	public List<ShiroSysAuthorityBean> getAuths() {
		return auths;
	}

	public void setAuths(List<ShiroSysAuthorityBean> auths) {
		this.auths = auths;
	}

	public Integer getAgreement() {
		return agreement;
	}

	public void setAgreement(Integer agreement) {
		this.agreement = agreement;
	}

	public String getBelongStoreName() {
		return belongStoreName;
	}

	public void setBelongStoreName(String belongStoreName) {
		this.belongStoreName = belongStoreName;
	}

	public String getBelongDepartmentName() {
		return belongDepartmentName;
	}

	public void setBelongDepartmentName(String belongDepartmentName) {
		this.belongDepartmentName = belongDepartmentName;
	}

	public String[] getResponsibleUserIdsArr() {
		return responsibleUserIdsArr;
	}

	public void setResponsibleUserIdsArr(String[] responsibleUserIdsArr) {
		this.responsibleUserIdsArr = responsibleUserIdsArr;
	}

	public String[] getResponsibleDepartmentIdsArr() {
		return responsibleDepartmentIdsArr;
	}

	public void setResponsibleDepartmentIdsArr(String[] responsibleDepartmentIdsArr) {
		this.responsibleDepartmentIdsArr = responsibleDepartmentIdsArr;
	}

	public String[] getResponsibleStoreIdsArr() {
		return responsibleStoreIdsArr;
	}

	public void setResponsibleStoreIdsArr(String[] responsibleStoreIdsArr) {
		this.responsibleStoreIdsArr = responsibleStoreIdsArr;
	}

	public Integer getWechatAuth() {
		return wechatAuth;
	}

	public void setWechatAuth(Integer wechatAuth) {
		this.wechatAuth = wechatAuth;
	}
}
